<?php

namespace app\common\model\user;

use app\common\model\artwork\Fbx;
use app\common\model\Product;
use think\Model;
use traits\model\SoftDelete;

class ArtworkAttribute extends Model
{

//    use SoftDelete;

    

    // 表名
    protected $name = 'user_artwork_attribute';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [

    ];

    protected $type = [
        'position' => 'array',
        'rotation' => 'array',
    ];

    protected $hidden = [
        'deletetime'
    ];



    public function artwork()
    {
        return $this->belongsTo(Artwork::class, 'artwork_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function fbx()
    {
        return $this->belongsTo(Fbx::class, 'fbx_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function product()
    {
        return $this->belongsTo(Product::class, 'product_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
